var o = require("../../../../mybehaviors/location/location");

Component({
    behaviors: [ o ],
    properties: {
        params: {
            type: null
        },
        data: {
            type: null
        },
        is_url: {
            type: null
        }
    },
    data: {
        address: "",
        point: {
            lat: "",
            lng: ""
        },
        city: ""
    },
    lifetimes: {
        attached: function() {},
        moved: function() {},
        detached: function() {}
    },
    attached: function() {},
    ready: function() {
        this._getLocation();
    },
    pageLifetimes: {
        show: function() {},
        hide: function() {},
        resize: function() {}
    },
    methods: {
        tolocation: function() {
            this.data.data[0].home ? wx.navigateTo({
                url: "/packageC/o2o/o2oLocation/o2oLocation?tag=home"
            }) : this.properties.is_url ? wx.navigateTo({
                url: "/packageC/o2o/o2oLocation/o2oLocation?tag=diy"
            }) : wx.navigateTo({
                url: "/packageC/o2o/o2oLocation/o2oLocation"
            });
        },
        tosearch: function() {
            this.data.city ? wx.navigateTo({
                url: "/packageC/o2o/o2oSearch/o2oSearch?city=" + this.data.city + "&point=" + JSON.stringify(this.data.point)
            }) : wx.showToast({
                icon: "none",
                title: "请先选择城市",
                duration: 1e3
            });
        }
    }
});